
package com.yuhanginfo.modules.sys.service;

import java.util.HashMap;
import java.util.Map;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

import com.yuhanginfo.common.persistence.Page;
import com.yuhanginfo.common.service.CrudService;
import com.yuhanginfo.modules.sys.entity.Orders;
import com.yuhanginfo.modules.sys.entity.OrdersDetail;
import com.yuhanginfo.modules.sys.dao.OrdersDao;
import com.yuhanginfo.modules.sys.dao.OrdersDetailDao;

/**
 * 订单变更记录Service
 * @author yinhao
 * @version 2017-10-13
 */
@Service
@Transactional(readOnly = true)
public class OrdersChangeHistoryService extends CrudService<OrdersDao, Orders> {
    @Autowired
    private OrdersDao ordersDao;
    
    
    @Autowired
    private OrdersDetailDao ordersDetailDao;
    

	
	public Map<String,Object> findDetailList(Orders orders) {
		Map<String,Object> resultMap = new HashMap<>();
		Orders ordersResult = ordersDao.getByChangeCode(orders);
		resultMap.put("orders", ordersResult);
		OrdersDetail queryOrdersDetail = new OrdersDetail();
		queryOrdersDetail.setOrdersChangeCode(orders.getChangeCode());
		resultMap.put("detailList", ordersDetailDao.findListByOrdersChangeCode(queryOrdersDetail));
		return resultMap;
	}
	
	public Page<Orders> findPage(Page<Orders> page, Orders orders) {
		orders.setPage(page);
		page.setList(ordersDao.findOrdersChangeHistoryList(orders));
		return page;
	}
	
	

}